<template>
    <div>
        <p style="font-weight: bold" class="interfaceHead"><i class="el-icon-s-promotion"></i>信息查询</p>
        <el-divider></el-divider>
        <el-input style="width: 40%"
                  placeholder="请输入单位名称进行搜索..."
                  prefix-icon="el-icon-search"
                  v-model="findName">
        </el-input>
        <el-button style="margin-left: 20px" @click="getMessageList" type="primary">搜索</el-button>
        <el-table
                border
                :data="searchTable"
                style="width: 100%;margin-top: 20px">
            <el-table-column
                    prop="check_date"
                    label="检查日期"
                    align="center"
                    width="100">
            </el-table-column>
            <el-table-column
                    prop="name"
                    label="单位名称"
                    align="center"
                    width="160">
            </el-table-column>
            <el-table-column
                    prop="facility_r"
                    label="场地合格判断"
                    align="center"
                    width="130">
            </el-table-column>
            <el-table-column
                    prop="check_result"
                    label="检查合格判断"
                    align="center"
                    width="130">
            </el-table-column>
            <el-table-column
                    label="现场照片"
                    align="center">
                <template slot-scope="scope">
                    <el-button
                            size="mini"
                            @click="showImg">查看</el-button>
                </template>

            </el-table-column>
        </el-table>
            <!--照片查看-->
        <div>
            <el-dialog
                    title="现场照片查看"
                    :visible.sync="dialogVisible"
                    width="50%">
                <div>
<!--                  <img style="width: 180px; height: 250px" :src="this.$store.state.baseApi+" alt="">-->
                </div>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="dialogVisible = false">取 消</el-button>
                    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                </span>
            </el-dialog>
        </div>
    </div>
</template>

<script>
    export default {
        name: "HealthSupSearch",
        data(){
            return{
                dialogVisible:false,
                findName:'',
                searchTable: [],
            }
        },
        mounted() {
            this.inittable();
        },
        methods:{
            showImg(){
                this.dialogVisible = true;
            },
            handleEdit(index,row){
                this.getRequest('').then(resp=>{

                })
            },
            inittable(){
                this.getRequest('/check/checkall').then(resp=>{
                    if(resp){
                        console.log(resp);
                        this.searchTable = resp.data.data;
                    }
                })
            },
            getMessageList(){
                this.getRequest('/check/check/' + this.findName).then(resp=>{
                    if(resp){
                        console.log(resp);
                        this.searchTable = resp.data.data;
                        if(this.findName==''){
                            this.inittable();
                        }
                    }
                })
            },
        }
    }
</script>

<style scoped>

</style>
